<?php
require_once realpath (dirname (__FILE__) . '//..//..//..//..//pages.php');
require_once INC_FUNCTIONS;
$db = openConnection();
$result = $db->select (array ('materia', 'effettua', 'intervento'), array ('materia.nome', 'COUNT(*) AS interventi'), 'effettua.IDmateria=materia.ID AND effettua.IDintervento=intervento.ID', 'materia.ID');
while ($row = $db->fetchAssoc ($result)) {
    $x[] = $row['nome'];
    $y[] = $row['interventi'];
}

if (!isset ($x) || empty ($x) || !isset ($y) || empty ($y)) {
    notify ('No data to load');
    exit ();
}

require_once GRAPH_PIE;
?>
